#include <CL/sycl.hpp>

class kernel;

class usm_selector : public sycl::device_selector{
  int operator()(const sycl::device& dev) const {
    if(dev.has(sycl::aspect::usm_device_allocations)){
      if(dev.has(sycl::aspect::cpu)) return 2;
      return 1;
    }
    return -1;
  }
};

int main(){
  constexpr dataSize;
  int a[dataSize], b[dataSize], r[dataSize];

  try{
    auto myQueue = sycl::queue(usm_selector{});

    auto devA = sycl::malloc_device<float>(dataSize, myQueue);
    ...

    myQueue.memcpy(devA, a, sizeof(float)*dataSize);
    ...

    myQueue.parallel_for<kernel>(
      sycl::range{dataSize},
      [=](sycl::id<1> idx){
        devR[idx] = devA[idx] + devB[idx];
      }
    );

    myQueue.memcpy(r, devR, sizeof(float)*dataSize);

  } catch(const sycl::exception& e){
    std::cout<<e.what()<<std::endl;
  }

  return 0;
}